import request from '@/utils/request'

// 商品标签分页
export function pageGoodsTag(query) {
  return request({
    url: '/goods/projectGoodsTag/paging',
    method: 'get',
    params: query
  })
}
// 保存商品标签
export function saveGoodsTag(data) {
  return request({
    url: '/goods/projectGoodsTag/save',
    method: 'post',
    data: data
  })
}

// 删除商品标签
export function deleteTag(data) {
  return request({
    url: '/goods/projectGoodsTag/batchDelete',
    method: 'post',
    data: data
  })
}
// 保存商品标签对应商品集合
export function saveGoodsTagDetail(data) {
  return request({
    url: '/goods/projectGoodsTagDetail/save',
    method: 'post',
    data: data
  })
}

// 商品标签选的商品分页
export function pageGoodsTagSelectGoods(params) {
  return request({
    url: '/goods/projectGoodsTagDetail/pageGoodsTagSelectGoods',
    method: 'get',
    params: params
  })
}
/**
 * 根据业务类型获取商品标签集合
 * @param {Object} busType
 * @param {Object} enterpriseId
 */
export function getGoodsTagListByBusType(busType, enterpriseId) {
  const params = {}
  params.busType = busType
  params.enterpriseId = enterpriseId
  return request({
    url: '/goods/projectGoodsTag/getGoodsTagListByBusType',
    method: 'get',
    params: params
  })
}

/**
 * 批量新增或更新商品标签绑定商品信息
 *  @param {Object} data
 */
export function batchSaveGoodsTagDetail(data) {
  return request({
    url: '/goods/projectGoodsTagDetail/batchSave',
    method: 'post',
    data: data
  })
}
